package com.itheima.day16.reflect.test1;

// 获取Class类对象
// 三种方式
public class Test {
    public static void main(String[] args) throws ClassNotFoundException {
        // 1.通过Class类中的静态方法forName("全类名")
        Class<?> classname1 = Class.forName("com.itheima.day16.reflect.test1.Student");
        System.out.println(classname1);

        // 2.通过class属性来获得
        Class<Student> classname2 = Student.class;
        System.out.println(classname2);

        // 3.利用对象的getclass方法来获取class对象
        // getclass方法是定义在object类中
        Student s = new Student();
        Class<? extends Student> classname3 = s.getClass();
        System.out.println(classname3);

        System.out.println(classname1 == classname2);
        System.out.println(classname1 == classname3);
        System.out.println(classname2 == classname3);

    }
}
